list=[1,5,8,-17,15,25,78,-5,36,50,40]
A=sum(list[:5])
B=sum(list[-6:-1])
list.append(A+B)
print(list)